﻿using mozhi.smarterp.Business.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
using Volo.Abp.Application.Dtos;

namespace mozhi.smarterp.Business.Purchases.Order
{
    public class PurchaseOrderUpdateDto : EntityDto<Guid?>
    {
        public Guid DepartmentId { get; set; }

        [Required]
        public DateTime Date { get; set; }

        /// <summary>
        /// 建议供应商
        /// </summary>
        [Required]
        public Guid SupplierId { get; set; }

        /// <summary>
        ///要货日期
        /// </summary>
        public DateTime RequiredDate { get; set; }

        public string Comment { get; set; }

        /// <summary>
        /// 订单类型
        /// </summary>
        [Required]
        public PurchaseOrderType Type { get; set; }

        [Required]
        public Guid CurrencyId { get; set; }

        [Required]
        public decimal ExchangeRate { get; set; }


        public bool IncludeTax { get; set; }

        /// <summary>
        /// 采购员
        /// </summary>
        [Required]
        public Guid PurchaserId { get; set; }

        public Guid? PaymentTermId {  get; set; }

        public List<PurchaseOrderItemUpdateDto> Items { get; set; }

        public List<PurchaseOrderAdvancePaymentUpdateDto> AdvancePaymentItems { get; set; }
    }

    public class PurchaseOrderItemUpdateDto : EntityDto<Guid?>
    {
        [Required]
        public Guid ProductId { get; set; }

        /// <summary>
        /// 申请单位
        /// </summary>
        [Required]
        public Guid PurchaseUnitId { get; set; }

        /// <summary>
        /// 申请数量
        /// </summary>
        [Required]
        public decimal PurchaseQuantity { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        public decimal? Price { get; set; }


        public Guid? TaxRateId { get; set; }

        public bool IsGift {  get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
    }

    public class PurchaseOrderAdvancePaymentUpdateDto : EntityDto<Guid?>
    {
        [Required]
        public decimal AdvancePaymentPercent { get; set; }

        public DateTime? DueDate { get; set; }

        public DateTime? ExpectedDate { get; set; }

        public int Index { get; set; }
    }
}
